﻿using System;
using Bank.Services;
using System.Diagnostics.Contracts;

namespace Bank.Operations
{
    public abstract class Operation : IOperation
    {
        protected IOperationLogger _operationLogger = new SimpleOperationLogger();

        public virtual void ExecuteOperation(IAccount account)
        {
            Contract.Ensures(account.Ballance > 0);

            _operationLogger.LogOperation(this);
        }


        public virtual void ExecuteOperation2(IAccount account)
        {
            Contract.Ensures(account.Ballance2 > 0);

            _operationLogger.LogOperation(this);
        }

        public abstract string GetOperationName();
    }
}
